﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Model;
using Repository;

namespace UI.Models
{
    public class CategoryModel
    {
        public List<Category> liCateGory
        {
            get
            {
                List<Category> liCateGory = new List<Category>();
                var repository = RepositoryManager.CreateCategoryRepository();
                liCateGory = repository.GetAllHaveCategory();
                return liCateGory;
            }
        }

        public List<Province> Provinces 
        { 
            get
            {
                var provinceRep = RepositoryManager.CreateProvinceRepository();
                var objProvince = provinceRep.GetAll();
                return objProvince;
            } 
        }

        public List<District> Districts
        {
            get
            {
                var districteRep = RepositoryManager.CreateDistrictRepository();
                var objDistricts = districteRep.GetAllByProvince(1);
                District obj = new District();
                obj.Id = 0;
                obj.Name = "Tất cả";
                objDistricts.Add(obj);
                return objDistricts;
            } 
        }
    }
}